package com.example.demo.design.chain_responsibility.solution;

/**
 * @Author: liull
 * @Description:
 * @Date: Created in 16:49 2020/12/24
 * @Modified By:
 */
public class Client {
    public static void main(String[] args) {
        Approver director, congress, president, vicePresident;
        director = new Director("主任");
        vicePresident = new VicePresident("副董事长");
        president = new President("董事长");
        congress = new Congress("董事会");
        // 创建职责链
        director.setSuccessor(vicePresident);
        vicePresident.setSuccessor(president);
        president.setSuccessor(congress);

        // 创建采购单
        PurchaseRequest pr1 = new PurchaseRequest(45000, 10001, "购买倚天剑");
        director.processRequest(pr1);
        PurchaseRequest pr2 = new PurchaseRequest(60000, 10002, "购买《葵花宝典》");
        director.processRequest(pr2);
        PurchaseRequest pr3 = new PurchaseRequest(160000, 10003, "购买《金刚经》");
        director.processRequest(pr3);
        PurchaseRequest pr4 = new PurchaseRequest(800000, 10004, "购买桃花岛");
        director.processRequest(pr4);
    }
}
